<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<!DOCTYPE html>
<html lang="zh-CN">
<head>

  <%@ include file="/WEB-INF/include/meta.jsp"%>
  <%@ include file="/WEB-INF/include/css.jsp"%>
  
</head>

<body>

  <%@ include  file="/WEB-INF/include/header.jsp"%>
  
  <%@ include file="/WEB-INF/include/menu.jsp"%>
  
  <div class="container main-content">
  
    <div class="panel panel-default x-panel x-panel-layout">
    
      <div class="panel-heading">
        <ol class="breadcrumb">
          <li><a href="${ctx.host}/user">用户管理</a></li>
          <li class="active">访客记录</li>
        </ol>
      </div>
    
      <div class="panel-body">
      
        <div class="col-xs-2 x-panel-layout-left no-horizontal-padding">
          <%@ include file="/WEB-INF/include/submenu.jsp"%>
        </div>
      
        <div class="col-xs-10 x-panel-layout-right">
          <div class="x-breadcrumb-wrapper">
            <div class="x-breadcrumb clearfix">
              <h2><i class="glyphicon glyphicon-fire"></i>&nbsp;&nbsp;<span>访客管理&nbsp;-&nbsp;访客列表</span></h2>
            </div>
          </div>
          
          <div class="x-toolbar-wrapper top-margin-20 clearfix">
            <div class="btn-group pull-right">
              <a href="${ctx.host}/visitor-records/search${not empty queryString ? '?'.concat(queryString) : ''}" data-target="#" data-toggle="modal" class="btn btn-default x-btn btn-shadow btn-shadow-default">
                <i class="glyphicon glyphicon-search"></i>&nbsp;&nbsp;过滤查询
              </a>
              <a href="${ctx.host}/visitor-records/create" data-target="#record-create" data-toggle="modal" class="btn btn-default x-btn btn-shadow btn-shadow-default">
                <i class="glyphicon glyphicon-plus"></i>&nbsp;&nbsp;添加
              </a>
              <a href="${ctx.host}/visitor-records/export-view" data-target="#export" data-toggle="modal" class="btn btn-default x-btn btn-shadow btn-shadow-default pull-right">导出</a>
            </div>
          </div>
          
          <p class="text-center" style="background-color: #69AB1F; color: #fff; padding-top: 6px; padding-bottom:6px; margin-bottom:0px; margin-top:10px;">
            <a href="${ctx.host}/visitor-records?day=${day-1}" class="button button-link button-nav pull-left" style="text-decoration: none; color: #fff;">&nbsp;&nbsp;<span class="glyphicon glyphicon-chevron-left"></span>前一天</a>
            <fmt:formatDate value="${date}" pattern="yyyy-MM-dd" />
            <c:if test="${!isToday}"> 
              &nbsp;&nbsp;<a href="${ctx.host}/visitor-records?day=${day+1}" class="button button-link button-nav pull-right" style="text-decoration: none; color: #fff;">后一天<span class="glyphicon glyphicon-chevron-right"></span>&nbsp;&nbsp;</a>
            </c:if>
          </p>
          <table class="table table-striped table-hover x-table" style="margin-bottom:20px; margin-top: 0px;">
            <thead>
              <tr>
                <th>姓名</th>
                <th>电话</th>
                <th>首次需求</th>
                <th>首次接待人</th>
                <th>来访渠道</th>
                <th>操作人</th>
                <th>首次接触时间</th>
                <th class="text-center">操作</th>
              </tr>
            </thead>
            <tbody>
              <c:forEach var="visitorRecord" items="${visitorRecords}">
                <tr>
                  <td>${visitorRecord.name}</td>
                  <td>${visitorRecord.mobile}</td>
                  <td>${visitorRecord.demand}</td>
                  <td>${visitorRecord.receiver.name}</td>
                  <td>${visitorRecord.visitChannel.description}</td>
                  <td>${visitorRecord.principal.name}</td>
                  <td><fmt:formatDate value="${visitorRecord.occurDate}" pattern="yyyy-MM-dd"/></td>
                  <td class="text-center">
                    <a href="${ctx.host}/visitor-records/${visitorRecord.id}/edit" title="修改" data-toggle="modal" data-target="#record-edit" data-validate="required">修改</a>
                    <a href="${ctx.host}/visitor-records/${visitorRecord.id}/delete" title="删除" data-toggle="modal" data-target="#record-delete" data-validate="required">删除</a>
                  </td>
                </tr>
              </c:forEach>
            </tbody>
          </table>
          
          <div class="form-horizontal clearfix">
            
            <jsp:include page="/WEB-INF/include/page.jsp">
              <jsp:param name="url" value="visitor-records" />
              <jsp:param name="queryString" value="${queryString}" />
            </jsp:include>
            
          </div>
          
        </div>
      </div>
    </div>
  </div>
  
  <%@ include file="/WEB-INF/include/script.jsp"%>
  <d:resource root="${ctx.resource}/build" type="script" src="js/page/user/visitor-record-list.js">
    <script type="text/javascript">
      require(['page/user/visitor-record-list'], function(page) {
        page.init({
          "today": '${today}'
        })
      })
    </script>
  </d:resource>
  
</body>
</html>